package com.dzl.aboutus;

import com.dzl.aboutUs.pojo.WelfareAboutUs;
import com.dzl.aboutUs.service.WelfareAboutUsService;
import com.dzl.admin.WelfareBaseInfoController;
import com.dzl.base.controller.BaseController;
import com.dzl.util.JsonResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 关于我们(WelfareAboutUs)表控制层
 * @author caobucao
 * @since 2021-05-13 15:54:17
 */
@Api(value = "小程序端-关于我们管理", tags = "小程序端-关于我们管理")
@RestController
@RequestMapping("welfareAboutUs")
public class WelfareAboutUsController extends BaseController {

    @Autowired
    private WelfareAboutUsService welfareAboutUsService;

    /**
     * 关于我们获取
     * @return com.dzl.util.JsonResult
     * @author ChenLong
     * @date 2021-06-07 11:14:32
     **/
    @GetMapping("getAboutUsInfo")
    public JsonResult<WelfareAboutUs> getAboutUsInfo() {
        HttpServletRequest request = getHttpServletRequest();
        String enterpriseId = request.getHeader("enterpriseId");
        if(null==enterpriseId){
            return JsonResult.paramErrWithMsg("获取企业ID失败");
        }else {
            WelfareAboutUs aboutUs = new WelfareAboutUs();
            aboutUs.setEnterpriseId(Integer.valueOf(enterpriseId));
            return JsonResult.success(welfareAboutUsService.selectOne(aboutUs));
        }
    }
}
